import 'amfe-flexible';
import '@/lib/assets/less/reset.less';
import '@/lib/assets/less/commom.less';
import pages from '@/config/pages';

import AppTouch from 'app-touch';
import BaseVue from '../BaseVue';
import Apicloud from '@/lib/plugins/Apicloud';
import EventEmitter from '@/lib/plugins/EventEmitter';
import ImageLazyload from '@/lib/directives/ImageLazyload';
import lazyloadConfig from '@/config/lazyload';
import Cache from '@/lib/core/Cache';

new AppTouch(document.body, { openPress: true, tapInterval: 400 });

BaseVue.use(Apicloud);
BaseVue.use(EventEmitter);
BaseVue.use(ImageLazyload, lazyloadConfig);


export default abstract class BaseApp extends BaseVue {

    // 状态栏高度
    private mStatusBarHeight = Cache.getLocalCache().get('__safeArea__top' as any) || 0;
    // 底部不可见区域高度
    private mFootetBarHeight = Cache.getLocalCache().get('__safeArea__bottom' as any) || 0;


    abstract apiready(): void;

    public initApp() {
        const safeArea = api.safeArea;
        this.mStatusBarHeight = safeArea.top;
        this.mFootetBarHeight = safeArea.bottom;
        Cache.getLocalCache().set('__safeArea__top' as any, safeArea.top);
        Cache.getLocalCache().set('__safeArea__bottom' as any, safeArea.bottom);
        const apicloud: any = this.$apicloud;
        apicloud.initDialog();

    }


    /**
     * 获取状态栏高度
     */
    public getStatusBarHeight() {
        return this.mStatusBarHeight;
    }

    /**
     * 获取底部不可见区域高度
     */
    public getFootetBarHeight() {
        return this.mFootetBarHeight;
    }




} 
